package bbs.aspect;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;

/**
 * Controller 中的 统一异常处理
 * @author ljg;
 * @create 2022-06-07 15:48
 */
@ControllerAdvice
public class ControllerExceptionAspect {

    Logger logger = LoggerFactory.getLogger(ControllerExceptionAspect.class) ;
    public ResponseEntity<String> exceptionController(Exception e){
        logger.error(e.getMessage(),e);
        e.printStackTrace();
        return ResponseEntity.status(500).body("出错了。。。");
    }
}
